package com.qiguliuxing.dts.db.dao.ex;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.qiguliuxing.dts.db.domain.DtsOrder;

public interface OrderMapper {
	
	int updateWithOptimisticLocker(@Param("lastUpdateTime") LocalDateTime lastUpdateTime,
                                   @Param("order") DtsOrder order);
	
	/**
	 * 根据条件获取入驻店铺的订单
	 * @param userId
	 * @param orderSn
	 * @param orderStatusSql
	 * @param orderBySql
	 * @param brandIdsSql
	 * @return
	 */
	List<DtsOrder> selectBrandOrdersByExample(@Param("userId") Integer userId, @Param("orderSn") String orderSn, @Param("fetchCode") String fetchCode, @Param("orderStatusSql") String orderStatusSql, @Param("orderBySql") String orderBySql,
                                              @Param("brandIdsSql") String brandIdsSql);

	List<DtsOrder> selectBrandOrdersByExampleVerify(@Param(value = "startTime") String startTime,@Param(value = "endTime") String endTime,@Param(value = "brandIds") List<Integer> brandIds, @Param("userId") Integer userId, @Param("orderSn") String orderSn, @Param("fetchCode") String fetchCode, @Param("orderStatusSql") String orderStatusSql, @Param("orderBySql") String orderBySql,
													@Param("brandIdsSql") String brandIdsSql);

	/**
	 * 根据传入的商品Id,获取含有该商品的未支付订单数
	 * @param goodsId
	 * @param orderStatus
	 * @return
	 */
	Long selectUnpayOrderCnt(@Param("goodsId") Integer goodsId, @Param("orderStatus") Short orderStatus);
}